package com.game.doudizhu.model;

import lombok.Data;
import java.util.List;
import java.util.Map;

@Data
public class GameAction {
    private String type;
    private Long playerId;
    private String playerName;
    private List<Card> cards;
    private Integer points;
    private Long winner;
    private Map<Long, Integer> scores;

    public static GameAction createGameStartAction() {
        GameAction action = new GameAction();
        action.setType("GAME_START");
        return action;
    }

    public static GameAction createBidAction(Long playerId, String playerName, int points) {
        GameAction action = new GameAction();
        action.setType("BID");
        action.setPlayerId(playerId);
        action.setPlayerName(playerName);
        action.setPoints(points);
        return action;
    }

    public static GameAction createPlayAction(Long playerId, String playerName, List<Card> cards) {
        GameAction action = new GameAction();
        action.setType("PLAY");
        action.setPlayerId(playerId);
        action.setPlayerName(playerName);
        action.setCards(cards);
        return action;
    }

    public static GameAction createPassAction(Long playerId, String playerName) {
        GameAction action = new GameAction();
        action.setType("PASS");
        action.setPlayerId(playerId);
        action.setPlayerName(playerName);
        return action;
    }

    public static GameAction createJoinAction(Long playerId, String playerName) {
        GameAction action = new GameAction();
        action.setType("JOIN");
        action.setPlayerId(playerId);
        action.setPlayerName(playerName);
        return action;
    }

    public static GameAction createLeaveAction(Long playerId, String playerName) {
        GameAction action = new GameAction();
        action.setType("LEAVE");
        action.setPlayerId(playerId);
        action.setPlayerName(playerName);
        return action;
    }

    public static GameAction createGameOverAction(Long winner, Map<Long, Integer> scores) {
        GameAction action = new GameAction();
        action.setType("GAME_OVER");
        action.setWinner(winner);
        action.setScores(scores);
        return action;
    }
} 